package com.orange.core.pojo.entity.credit;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.orange.core.pojo.entity.ICreateModel;
import com.orange.core.pojo.entity.IIntIdModel;
import com.orange.core.pojo.enums.EFlowBusinessType;
import com.orange.core.pojo.enums.EFlowType;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

@Data
@Accessors(chain = true)
public class CreditFlow implements IIntIdModel<CreditFlow>, ICreateModel<CreditFlow> {

    @TableId(type = IdType.AUTO)
    private Integer id;

    private Integer userId;

    /**
     * 业务类型
     *
     * @see EFlowBusinessType
     */
    private Integer businessType;

    /**
     * 业务名称
     */
    @TableField(exist = false)
    private String businessName;

    /**
     * 业务id
     */
    private Integer businessId;

    /**
     * 积分流水类型：1 获取，2 消耗
     *
     * @see EFlowType
     */
    private Integer flowType;

    /**
     * 变动积分
     */
    private Integer credit;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @TableField(fill = FieldFill.INSERT)
    private Integer createBy;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private LocalDateTime createTime;
}
